﻿def sumtree(L):
    tot=0
    for x in L:
        if not isinstance(x,list):
            tot+=x
        else:
            tot+=sumtree(x)
    return tot
def mysum(L):
    if not L:
        return 0
    else:
        return L[0] +mysum(L[1:])


L=[1,[2,[3,4],5],6,[7,8]]
V=[2,4,6,8]
print(sumtree(L))
#print(mysum(L))
print(mysum(V))